<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>个人中心</title>
    <script th:src="@{/js/jquery-3.5.1.min.js}" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/layui-v2.6.4/layui/css/layui.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/layui-v2.6.4/layui/css/modules/code.css}"/>
    <script th:src="@{/layui-v2.6.4/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
    <script th:src="@{/js/angular.min.js}" type="text/javascript"></script>
    <script>
        layui.use('element', function () {
            var element = layui.element;
        });

        var app = angular.module("cems", []);
        app.controller("adminInfoController", function ($scope, $http, $filter) {
            $scope.getAdminInfo = function () {
                $http.get("/admin/getAdminInfo").success(function (response) {
                    $scope.admin = response;
                    $scope.admin.adminBirth = $filter('date')($scope.admin.adminBirth, 'yyyy-MM-dd');
                });
            }

            $scope.updateAdminInfo = function () {
                $http.post("/admin/updateAdminInfo", $scope.admin).success(function (response) {
                    // alert(response);
                    layer.msg(response);
                });
            }
        });
    </script>
</head>
<body ng-app="cems" ng-controller="adminInfoController" ng-init="getAdminInfo();">
<h1 align="left">个人信息</h1>
<hr>
<label class="layui-form-label">账号</label>
<div class="layui-input-block">
    <input type="text" ng-model="admin.adminNum" required lay-verify="required" placeholder="请输入标题"
           autocomplete="off" class="layui-input layui-disabled">
</div>
<label class="layui-form-label">手机号</label>
<div class="layui-input-block">
    <input type="text" ng-model="admin.adminPhone" required lay-verify="required" placeholder="请输入标题"
           autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">生日</label>
<div class="layui-input-block">
    <input type="date" ng-model="admin.adminBirth" required lay-verify="required" autocomplete="off"
           class="layui-input">
</div>
<label class="layui-form-label">电子邮箱</label>
<div class="layui-input-block">
    <input type="email" ng-model="admin.adminEmil" name="title" required lay-verify="required"
           placeholder="请输入电子邮箱" autocomplete="off" class="layui-input layui-disabled">
</div>
</div>
<div class="layui-form-item layui-form-text">
    <label class="layui-form-label">地址</label>
    <div class="layui-input-block">
        <textarea ng-model="admin.adminHouse" required placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
</div>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button class="layui-btn" ng-click="updateAdminInfo()">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</div>
</body>
</html>
